﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using NetCoreCMS.Common;
using NetCoreCMS.IServices;
using NetCoreCMS.Models;

namespace NetCoreCMS.Web.Areas.Admin.Controllers
{
    public class IndexController : ManageController
    {
        protected Manager admin_info;//管理员信息
        public IActionResult Index()
        {
            admin_info = GetAdminInfo();
            ViewBag.role_name = _manager_role.GetTitle(admin_info.role_id);
            ViewData["admin_info"] = admin_info;
            return View("~/Areas/Admin/Views/Index.cshtml");
        }
        public ActionResult LogOff()
        {
            HttpContext.Session.Remove(CMSKeys.SESSION_ADMIN_INFO);
            HttpContext.Response.Cookies.Delete("AdminName");
            HttpContext.Response.Cookies.Delete("AdminPwd");
            return RedirectToAction("Index", "Login");
        }
    }
}